package com.cuckoo.mall.thus.start;


import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.bgn.baseframe.base.BaseActivity;
import com.bgn.baseframe.utils.HttpCode;
import com.bgn.baseframe.utils.UiUtil;
import com.cuckoo.mall.R;
import com.cuckoo.mall.network.ApiManager;
import com.cuckoo.mall.thus.manager.UserInfoManager;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import retrofit2.http.HTTP;


/**
 * 作者：wl on 2018/4/ * 邮箱：wanglun@stosz.com
 */

@Route(path = "/mall/loginOutActivity", group = "mall")
public class LoginOutActivity extends BaseActivity {

    private int titleType;
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.tv_cancel)
    TextView tvCancel;
    @BindView(R.id.tv_sure)
    TextView tvSure;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setIsLoadTitleBar(false);
        setContentView(R.layout.activity_login_out);
        ButterKnife.bind(this);
        UserInfoManager.getInstance().exitLogin();

        titleType = getIntent().getIntExtra("type", HttpCode.TOKEN_ERROR);//  1001被挤了  1004时间过期
        if (titleType == HttpCode.TOKEN_ERROR) {
            tvTitle.setText(UiUtil.getString(R.string.token_error));
        } else {
            tvTitle.setText(UiUtil.getString(R.string.token_outtime));
        }
        tvCancel.setText(UiUtil.getString(R.string.login_out_keep));
        tvSure.setText(UiUtil.getString(R.string.relogin));
    }


    @OnClick({R.id.tv_title, R.id.tv_cancel, R.id.tv_sure})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.tv_cancel:
                ARouter.getInstance().build("/mall/mainActivity").withString("action", "home").navigation();
                break;
            case R.id.tv_sure:
                ARouter.getInstance().build("/mall/mainActivity").withString("action", "home").navigation();
                ARouter.getInstance().build("/mall/loginActivity").navigation();
                break;
        }
    }

    @Override
    public void onBackPressed() {

    }
}
